<template>
  <el-drawer title="详情" :visible="drawer" @close="handleClose">
    <el-form class="form" :label-width="width">
      <el-form-item
        v-for="[key, value] of Object.entries(info)"
        :key="key"
        :label="key + '：'"
      >
        <span>{{ value }}</span>
      </el-form-item>
    </el-form>
  </el-drawer>
</template>

<script>
export default {
  props: {
    drawer: {
      type: Boolean,
    },
    info: {
      type: Object,
      default: () => ({}),
    },
    width: {
      type: String,
      default: "140px",
    },
  },
  data() {
    return {};
  },
  methods: {
    handleClose() {
      this.$emit("update:drawer", false);
    },
  },
};
</script>

<style lang="scss" scoped>
:deep(.form) {
  padding: 0 20px 20px 20px;
  .el-form-item {
    margin-bottom: 0;
  }
  .el-form-item__label {
    color: #999;
    padding-right: 5px;
  }
}
</style>
